<!doctype html>
<html>
<head>
<meta charset="utf-8">
<TITLE>论坛--注册</TITLE>

<Link rel="stylesheet" type="text/css" href="style/style.css"/>

</HEAD>
<BODY>
<DIV>
	<IMG src="image/logo.gif">
</DIV>
<!--      用户信息、登录、注册        -->

	<DIV class="h">
		您尚未　<a href="login.html">登录</a>
		&nbsp;| &nbsp; <A href="reg.html">注册</A> |
	</DIV>


<BR/>
<!--      导航        -->
<DIV>
	&gt;&gt;<B><a href="index.html">论坛首页</a></B>
</DIV>
<!--      用户注册表单        -->
<DIV  class="t" style="MARGIN-TOP: 15px" align="center" id="app">
	<FORM name="regForm" action="" method="post">
		<br/>用&nbsp;户&nbsp;名 &nbsp;
			<INPUT class="input" tabIndex="1" tryp="text" maxLength="20" size="35" name="uname" v-model="uname">
		<br/>密&nbsp;&nbsp;&nbsp;&nbsp;码 &nbsp;
			<INPUT class="input" tabIndex="2" type="password" maxLength="20" size="40" name="upass" v-model="upass">
		<br/>重复密码 &nbsp;
			<INPUT class="input" tabIndex="3" type="password" maxLength="20" size="40" name="upass1" v-model="upass1">
		<br/>性别 &nbsp;
			女<input type="radio" name="gender" v-model="gender" value="FEMALE">
			男<input type="radio" name="gender" v-model="gender" value="MALE" checked="checked" />
		<br/>验证码
			<img src="http://localhost:20001/bbs-security/user/code.action" width="100px" height="50px">
			<input type="text" name="valcode" value="1234" v-model="valcode"/>
		<br/>请选择头像 <br/>
		<img src="image/head/1.gif"/><input type="radio" name="head" v-model="head" value="1.gif" checked="checked">
		<img src="image/head/2.gif"/><input type="radio" name="head" v-model="head" value="2.gif">
		<img src="image/head/3.gif"/><input type="radio" name="head" v-model="head" value="3.gif">
		<img src="image/head/4.gif"/><input type="radio" name="head" v-model="head" value="4.gif">
		<img src="image/head/5.gif"/><input type="radio" name="head" v-model="head" value="5.gif">
		<BR/>
		<img src="image/head/6.gif"/><input type="radio" name="head" v-model="head" value="6.gif">
		<img src="image/head/7.gif"/><input type="radio" name="head" v-model="head" value="7.gif">
		<img src="image/head/8.gif"/><input type="radio" name="head" v-model="head" value="8.gif">
		<img src="image/head/9.gif"/><input type="radio" name="head" v-model="head" value="9.gif">
		<img src="image/head/10.gif"/><input type="radio" name="head" v-model="head" value="10.gif">
		<BR/>
		<img src="image/head/11.gif"/><input type="radio" name="head" v-model="head" value="11.gif">
		<img src="image/head/12.gif"/><input type="radio" name="head" v-model="head" value="12.gif">
		<img src="image/head/13.gif"/><input type="radio" name="head" v-model="head" value="13.gif">
		<img src="image/head/14.gif"/><input type="radio" name="head" v-model="head" value="14.gif">
		<img src="image/head/15.gif"/><input type="radio" name="head" v-model="head" value="15.gif">
		<br/>
			<INPUT class="btn" tabIndex="4" type="button" value="注 册" @click="reg()">
	</FORM>
</DIV>
<!--      声明        -->
<BR>
<CENTER class="gray">源辰信息</CENTER>
</BODY>

<script src="js/axios.js"></script>
<!--<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>-->
<script src="js/vue.js"></script>

<script type="text/javascript">
	// 配置访问的地址
	var base_url = "http://localhost:20001/";	// gateway地址
	var addr_ressecurity = base_url + "bbs-security/";

	let vm = new Vue({
		el: "#app",
		data: {
			uname: "a",
			upass: "a",
			upass1: "a",
			head: "1.gif",
			gender: "MALE",
			valcode: 1234
		},
		methods: {
			reg:function(){
				if (this.upass != this.upass1){
					alert("两次输入密码不一致！");
					return;
				}
				var params = new URLSearchParams();
				params.append("uname", this.uname);
				params.append("upass", this.upass);
				params.append("head", this.head);
				params.append("gender", this.gender);
				params.append("valcode", this.valcode);

				// post的结果 是一个Promise对象
				axios.post(addr_ressecurity + "user/reg.action", params).then( data=>{
					if (data.data.code == 1){
						alert("注册成功");
						window.location="index.html";
					}
				});
			}
		},
		computed: {
		},
		mounted:function (){
		}
	});
</script>

</HTML>
